from bs4 import BeautifulSoup
doc_html="<html><body><p>contentone</p><b>contenttwo</b></body></html>"
soup=BeautifulSoup(doc_html,"lxml")
print(soup.p)
print(soup.html.body.b)

doc2_html="<html><body><p>contentone</p><b>contenttwo</b></body></html>"
soup=BeautifulSoup(doc2_html,"lxml")
print(soup.contents)
print(soup.contents[0].contents)
print(soup.contents[0].contents[0].contents)

for child in soup.children:
    print(child)

tag_p=soup.p
tag_p_parent=tag_p.parent
print(tag_p_parent)

tag_p_next_sibling=soup.p.next_sibling
tag_p_previous_sibling=soup.b.previous_sibling
print(tag_p_next_sibling)
print(tag_p_previous_sibling)